library(data.table)
## Warning: package 'data.table' was built under R version 3.4.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.4.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(stringr)
"%&%" = function(a,b) paste(a,b,sep="")
date <- Sys.Date()
my.dir <- "/Volumes/im-lab/nas40t2/hwheeler/trans-px/NCBI_Gene_Summaries/"
mediandf <- data.frame(matrix(ncol = 2, nrow = 0))
colnames(mediandf) <- c("WB_Med_P", "MT_Med_P")
allres <- data.frame(matrix(ncol = 10, nrow = 0))
colnames(allres) <- c("obsgene","predgene","WB_adjRsq","WB_Pval","MT_adjRsq","MT_Pval","an_Fstat","an_Pval","logWB","logMT")
for(i in c(0:100)){
ipad <- str_pad(i,3,pad="0")
res <- fread(my.dir %&% "compare_WB_MT_models/WB_v_MT_anova_FHS_list" %&% ipad %&% "_2019-01-15.txt")
res <- res[complete.cases(res),]
#I messed up the headers in 19_compare_WB_to_MT.R, fix here
colnames(res) <- c("obsgene","predgene","WB_adjRsq","WB_Pval","MT_adjRsq","MT_Pval","an_Fstat","an_Pval")
res <- mutate(res, logWB=ifelse(WB_Pval < 1e-30, 30, -1*log10(WB_Pval)), logMT=ifelse(MT_Pval < 1e-30, 30, -1*log10(MT_Pval)))
print(ggplot(res, aes(x=logWB, y=logMT)) + geom_bin2d() + geom_abline(slope=1,intercept = 0))
#boxplot comparing pvals
print(t.test(res$WB_Pval,res$MT_Pval))
boxres <- dplyr::select(res, `Whole Blood`=WB_Pval, `Multi-tissue`=MT_Pval)
medres <- data.frame(WB_Med_P=median(boxres$`Whole Blood`), MT_Med_P=median(boxres$`Multi-tissue`))
mediandf <- rbind(mediandf, medres)
boxres <- melt(boxres)
print(ggplot(boxres, aes(x=variable,y=value)) + geom_boxplot() + labs(x="Model",y="P value"))
allres <- rbind(allres, res)
}
##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 62.993, df = 1342700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03077231 0.03274871
## sample estimates:
## mean of x mean of y
## 0.4924826 0.4607221
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 79.836, df = 1348000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03871995 0.04066893
## sample estimates:
## mean of x mean of y
## 0.5006203 0.4609259
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 51.224, df = 1352800, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02470253 0.02666812
## sample estimates:
## mean of x mean of y
## 0.4926530 0.4669676
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 89.532, df = 1438200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04203712 0.04391879
## sample estimates:
## mean of x mean of y
## 0.500689 0.457711
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 54.058, df = 1405500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02547426 0.02739097
## sample estimates:
## mean of x mean of y
## 0.4858178 0.4593852
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 76.422, df = 1402900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03643941 0.03835772
## sample estimates:
## mean of x mean of y
## 0.5022479 0.4648493
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 61.917, df = 1423200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02899539 0.03089109
## sample estimates:
## mean of x mean of y
## 0.5072653 0.4773221
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 77.341, df = 1315700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03758913 0.03954382
## sample estimates:
## mean of x mean of y
## 0.5020420 0.4634755
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 79.023, df = 1420300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03714015 0.03902935
## sample estimates:
## mean of x mean of y
## 0.5096639 0.4715792
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 70.765, df = 1466300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03297226 0.03485075
## sample estimates:
## mean of x mean of y
## 0.4942087 0.4602972
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 64.8, df = 1381300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03060839 0.03251773
## sample estimates:
## mean of x mean of y
## 0.5125816 0.4810185
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 58.098, df = 1354100, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02804513 0.03000341
## sample estimates:
## mean of x mean of y
## 0.4830543 0.4540300
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 56.878, df = 1318300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02762740 0.02959938
## sample estimates:
## mean of x mean of y
## 0.4992187 0.4706053
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 83.997, df = 1422700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03965151 0.04154615
## sample estimates:
## mean of x mean of y
## 0.5142822 0.4736834
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 75.072, df = 1458900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03470127 0.03656178
## sample estimates:
## mean of x mean of y
## 0.5030022 0.4673706
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 59.923, df = 1478600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02766520 0.02953616
## sample estimates:
## mean of x mean of y
## 0.4934155 0.4648148
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 91.39, df = 1318400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04509449 0.04707110
## sample estimates:
## mean of x mean of y
## 0.5030525 0.4569697
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 59.032, df = 1317700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02899163 0.03098290
## sample estimates:
## mean of x mean of y
## 0.4913426 0.4613553
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 71.563, df = 1418500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03357808 0.03546916
## sample estimates:
## mean of x mean of y
## 0.5107152 0.4761915
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 67.78, df = 1436900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03145508 0.03332839
## sample estimates:
## mean of x mean of y
## 0.5105221 0.4781304
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 96.447, df = 1419900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04576228 0.04766079
## sample estimates:
## mean of x mean of y
## 0.5041196 0.4574080
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 97.911, df = 1438600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04612552 0.04800991
## sample estimates:
## mean of x mean of y
## 0.5146900 0.4676223
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 77.575, df = 1409000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03685377 0.03876430
## sample estimates:
## mean of x mean of y
## 0.512773 0.474964
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 81.007, df = 1346700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03952764 0.04148782
## sample estimates:
## mean of x mean of y
## 0.5069934 0.4664856
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 65.702, df = 1485200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02992137 0.03176143
## sample estimates:
## mean of x mean of y
## 0.5062271 0.4753857
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 61.631, df = 1344300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02973949 0.03169317
## sample estimates:
## mean of x mean of y
## 0.4958063 0.4650900
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 97.979, df = 1427900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04596640 0.04784295
## sample estimates:
## mean of x mean of y
## 0.5090891 0.4621844
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 99.143, df = 1359600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04845000 0.05040426
## sample estimates:
## mean of x mean of y
## 0.5012013 0.4517742
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 80.712, df = 1378900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03886387 0.04079833
## sample estimates:
## mean of x mean of y
## 0.4995958 0.4597647
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 2.9599, df = 1444800, p-value = 0.003077
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.000486729 0.002394767
## sample estimates:
## mean of x mean of y
## 0.4795763 0.4781356
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 61.051, df = 1319800, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02940943 0.03136037
## sample estimates:
## mean of x mean of y
## 0.5025097 0.4721248
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 44.34, df = 1404800, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02069706 0.02261143
## sample estimates:
## mean of x mean of y
## 0.4944858 0.4728316
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 56.244, df = 1361400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02683104 0.02876857
## sample estimates:
## mean of x mean of y
## 0.5024475 0.4746477
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 72.443, df = 1206600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03710574 0.03916939
## sample estimates:
## mean of x mean of y
## 0.4960218 0.4578842
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 22.904, df = 1341500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01043713 0.01239060
## sample estimates:
## mean of x mean of y
## 0.5005253 0.4891114
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 53.225, df = 1357800, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02546915 0.02741661
## sample estimates:
## mean of x mean of y
## 0.4959346 0.4694917
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 119.7, df = 1328900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.05871711 0.06067202
## sample estimates:
## mean of x mean of y
## 0.5139051 0.4542105
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 121.5, df = 1320000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.06022309 0.06219794
## sample estimates:
## mean of x mean of y
## 0.5173783 0.4561677
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 70.159, df = 1417400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03299285 0.03488921
## sample estimates:
## mean of x mean of y
## 0.4975911 0.4636500
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 63.188, df = 1451400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02935538 0.03123477
## sample estimates:
## mean of x mean of y
## 0.4982010 0.4679059
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 89.144, df = 1429100, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04219663 0.04409386
## sample estimates:
## mean of x mean of y
## 0.5015887 0.4584434
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 70.011, df = 1450000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03272963 0.03461494
## sample estimates:
## mean of x mean of y
## 0.5082573 0.4745851
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 105.98, df = 1431200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.05081613 0.05273117
## sample estimates:
## mean of x mean of y
## 0.4989149 0.4471413
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 85.542, df = 1426300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04036284 0.04225583
## sample estimates:
## mean of x mean of y
## 0.5124736 0.4711642
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 55.886, df = 1409700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02636965 0.02828649
## sample estimates:
## mean of x mean of y
## 0.4944119 0.4670838
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 33.134, df = 1407600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01533182 0.01725970
## sample estimates:
## mean of x mean of y
## 0.4801469 0.4638512
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 55.632, df = 1372300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02644863 0.02838031
## sample estimates:
## mean of x mean of y
## 0.5050040 0.4775896
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 43.693, df = 1463100, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01994762 0.02182127
## sample estimates:
## mean of x mean of y
## 0.4891036 0.4682191
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 91.443, df = 1192000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04744526 0.04952366
## sample estimates:
## mean of x mean of y
## 0.4998748 0.4513903
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 77.768, df = 1244100, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03934477 0.04137923
## sample estimates:
## mean of x mean of y
## 0.4977615 0.4573995
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 56.661, df = 1364200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02697802 0.02891130
## sample estimates:
## mean of x mean of y
## 0.4991929 0.4712482
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 108.46, df = 1419900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.05099994 0.05287716
## sample estimates:
## mean of x mean of y
## 0.5028885 0.4509500
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 112.06, df = 1461600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.05261569 0.05448900
## sample estimates:
## mean of x mean of y
## 0.4954002 0.4418479
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 102.22, df = 1358200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04996120 0.05191461
## sample estimates:
## mean of x mean of y
## 0.4970815 0.4461436
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 65.547, df = 1413700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03066429 0.03255464
## sample estimates:
## mean of x mean of y
## 0.5067141 0.4751046
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 98.708, df = 1399700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04707763 0.04898508
## sample estimates:
## mean of x mean of y
## 0.4959591 0.4479278
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 81.731, df = 1440600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03838196 0.04026805
## sample estimates:
## mean of x mean of y
## 0.5046345 0.4653095
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 18.547, df = 1404200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.008139593 0.010063133
## sample estimates:
## mean of x mean of y
## 0.4801044 0.4710030
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 59.49, df = 1378900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02830726 0.03023604
## sample estimates:
## mean of x mean of y
## 0.4971174 0.4678457
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 39.448, df = 1362200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01869921 0.02065450
## sample estimates:
## mean of x mean of y
## 0.4824140 0.4627371
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 61.965, df = 1439400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02869091 0.03056520
## sample estimates:
## mean of x mean of y
## 0.5083762 0.4787482
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 103.4, df = 1387800, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04975103 0.05167349
## sample estimates:
## mean of x mean of y
## 0.5097325 0.4590203
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 86.958, df = 1305500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04296662 0.04494816
## sample estimates:
## mean of x mean of y
## 0.5003468 0.4563894
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 82.507, df = 1353500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03999986 0.04194650
## sample estimates:
## mean of x mean of y
## 0.5079793 0.4670061
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 98.816, df = 1370000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04805352 0.04999833
## sample estimates:
## mean of x mean of y
## 0.4993749 0.4503490
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 79.059, df = 1384400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03787333 0.03979891
## sample estimates:
## mean of x mean of y
## 0.4926140 0.4537779
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 82.785, df = 1403700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03949020 0.04140543
## sample estimates:
## mean of x mean of y
## 0.5000546 0.4596068
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 65.641, df = 1436200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03069400 0.03258338
## sample estimates:
## mean of x mean of y
## 0.4985256 0.4668869
## No id variables; using all as measure variables


##
Read 94.0% of 755429 rows
Read 755429 rows and 8 (of 8) columns from 0.102 GB file in 00:00:03
##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 28.637, df = 1344300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01336138 0.01532473
## sample estimates:
## mean of x mean of y
## 0.4990668 0.4847237
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 85.786, df = 1404500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04086506 0.04277601
## sample estimates:
## mean of x mean of y
## 0.5122759 0.4704554
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 52.068, df = 1314400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02511351 0.02707812
## sample estimates:
## mean of x mean of y
## 0.5039022 0.4778064
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 77.632, df = 1421900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03674558 0.03864905
## sample estimates:
## mean of x mean of y
## 0.4963612 0.4586639
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 45.578, df = 1318000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02197531 0.02395023
## sample estimates:
## mean of x mean of y
## 0.5033971 0.4804343
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 6.242, df = 1383200, p-value = 4.322e-10
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.002093224 0.004009455
## sample estimates:
## mean of x mean of y
## 0.5077948 0.5047435
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 37.716, df = 1324000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01794225 0.01990929
## sample estimates:
## mean of x mean of y
## 0.4982608 0.4793350
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 47.65, df = 1314400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02302848 0.02500419
## sample estimates:
## mean of x mean of y
## 0.4984607 0.4744444
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 58.209, df = 1355900, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02812278 0.03008264
## sample estimates:
## mean of x mean of y
## 0.4958705 0.4667677
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 100.19, df = 1348500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04907448 0.05103276
## sample estimates:
## mean of x mean of y
## 0.5020944 0.4520407
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 30.493, df = 1367600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01405545 0.01598642
## sample estimates:
## mean of x mean of y
## 0.4952261 0.4802052
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 65.335, df = 1356700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03171333 0.03367489
## sample estimates:
## mean of x mean of y
## 0.4957917 0.4630976
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 36.249, df = 1318300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01735084 0.01933441
## sample estimates:
## mean of x mean of y
## 0.4972145 0.4788719
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 58.28, df = 1292200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02879348 0.03079755
## sample estimates:
## mean of x mean of y
## 0.4790544 0.4492589
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 43.186, df = 1355000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02039664 0.02233604
## sample estimates:
## mean of x mean of y
## 0.5029006 0.4815342
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 26.572, df = 1286600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.01263252 0.01464447
## sample estimates:
## mean of x mean of y
## 0.4844264 0.4707879
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 53.948, df = 1299300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02657867 0.02858269
## sample estimates:
## mean of x mean of y
## 0.4923282 0.4647475
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 64.625, df = 1284000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03189803 0.03389336
## sample estimates:
## mean of x mean of y
## 0.5049851 0.4720894
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 75.523, df = 1383400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03608150 0.03800418
## sample estimates:
## mean of x mean of y
## 0.4989283 0.4618854
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 73.255, df = 1369300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03473540 0.03664522
## sample estimates:
## mean of x mean of y
## 0.5189346 0.4832443
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 19.125, df = 1247600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.008979423 0.011030005
## sample estimates:
## mean of x mean of y
## 0.4833038 0.4732990
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 46.084, df = 1292700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02245446 0.02444929
## sample estimates:
## mean of x mean of y
## 0.4925874 0.4691355
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 54.334, df = 1392700, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02592863 0.02786927
## sample estimates:
## mean of x mean of y
## 0.4951641 0.4682651
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 63.138, df = 1439300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02949021 0.03137977
## sample estimates:
## mean of x mean of y
## 0.5025421 0.4721071
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 46.691, df = 1407300, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02184428 0.02375855
## sample estimates:
## mean of x mean of y
## 0.4997742 0.4769728
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 98.776, df = 1348400, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04807832 0.05002493
## sample estimates:
## mean of x mean of y
## 0.5065007 0.4574491
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 82.671, df = 1351000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04011998 0.04206851
## sample estimates:
## mean of x mean of y
## 0.4948471 0.4537528
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 88.202, df = 1375500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04225070 0.04417111
## sample estimates:
## mean of x mean of y
## 0.5157043 0.4724934
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 83.504, df = 1396600, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03968245 0.04159004
## sample estimates:
## mean of x mean of y
## 0.5154343 0.4747980
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 73.023, df = 1248000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03691619 0.03895254
## sample estimates:
## mean of x mean of y
## 0.4906932 0.4527588
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 76.028, df = 1383500, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03674641 0.03869115
## sample estimates:
## mean of x mean of y
## 0.4929111 0.4551923
## No id variables; using all as measure variables


##
Read 0.0% of 750976 rows
Read 750976 rows and 8 (of 8) columns from 0.100 GB file in 00:00:03
##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 63.759, df = 1196200, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03288403 0.03496988
## sample estimates:
## mean of x mean of y
## 0.4940303 0.4601033
## No id variables; using all as measure variables


##
## Welch Two Sample t-test
##
## data: res$WB_Pval and res$MT_Pval
## t = 36.094, df = 664260, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.02406455 0.02682809
## sample estimates:
## mean of x mean of y
## 0.4970378 0.4715915
## No id variables; using all as measure variables


t.test(mediandf$WB_Med_P,mediandf$MT_Med_P)
##
## Welch Two Sample t-test
##
## data: mediandf$WB_Med_P and mediandf$MT_Med_P
## t = 23.863, df = 190.35, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.04250862 0.05016929
## sample estimates:
## mean of x mean of y
## 0.4995921 0.4532531
allboxmed <- melt(mediandf)
## No id variables; using all as measure variables
ggplot(allboxmed, aes(x=variable,y=value)) + geom_boxplot() + labs(x="Model",y="P value")

t.test(allres$WB_Pval,allres$MT_Pval)
##
## Welch Two Sample t-test
##
## data: allres$WB_Pval and allres$MT_Pval
## t = 681.82, df = 137890000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.03349236 0.03368547
## sample estimates:
## mean of x mean of y
## 0.5000122 0.4664233
t.test(allres$WB_Pval,allres$MT_Pval)$p.value
## [1] 0
grabP <- dplyr::select(allres, WB_Pval, MT_Pval)
boxP <- melt(grabP)
## No id variables; using all as measure variables
ggplot(boxP, aes(x=variable,y=value)) + geom_boxplot() + labs(x="Model",y="P value")

summary(allres)
## obsgene predgene WB_adjRsq
## Length:68947673 Length:68947673 Min. :-2.068e-04
## Class :character Class :character 1st Qu.:-1.858e-04
## Mode :character Mode :character Median :-1.126e-04
## Mean : 4.000e-08
## 3rd Qu.: 6.676e-05
## Max. : 5.694e-02
## WB_Pval MT_adjRsq MT_Pval an_Fstat
## Min. :0.0000 Min. :-3.478e-03 Min. :0.0000 Min. : 0.0000
## 1st Qu.:0.2501 1st Qu.:-4.403e-04 1st Qu.:0.2108 1st Qu.: 0.5700
## Median :0.4999 Median :-5.776e-05 Median :0.4533 Median : 0.9441
## Mean :0.5000 Mean : 9.116e-05 Mean :0.4664 Mean : 1.1075
## 3rd Qu.:0.7500 3rd Qu.: 4.837e-04 3rd Qu.:0.7136 3rd Qu.: 1.4404
## Max. :1.0000 Max. : 5.737e-02 Max. :1.0000 Max. :145.5990
## an_Pval logWB logMT
## Min. :0.0000 Min. : 0.0000 Min. : 0.0000
## 1st Qu.:0.2023 1st Qu.: 0.1250 1st Qu.: 0.1466
## Median :0.4430 Median : 0.3011 Median : 0.3436
## Mean :0.4611 Mean : 0.4343 Mean : 0.4888
## 3rd Qu.:0.7091 3rd Qu.: 0.6018 3rd Qu.: 0.6760
## Max. :1.0000 Max. :30.0000 Max. :30.0000
ggplot(allres, aes(x=logWB, y=logMT)) + geom_bin2d() + geom_abline(slope=1,intercept = 0)

t.test(allres$WB_adjRsq,allres$MT_adjRsq)
##
## Welch Two Sample t-test
##
## data: allres$WB_adjRsq and allres$MT_adjRsq
## t = -897.09, df = 87615000, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -9.131832e-05 -9.092016e-05
## sample estimates:
## mean of x mean of y
## 3.784200e-08 9.115708e-05
t.test(allres$WB_adjRsq,allres$MT_adjRsq)$p.value
## [1] 0
ggplot(allres, aes(x=WB_adjRsq, y=MT_adjRsq)) + geom_bin2d() + geom_abline(slope=1,intercept = 0) + labs(x=expression(paste("Whole Blood adjusted ", R^2)),y=expression(paste("Multi-Tissue adjusted ", R^2)))

grabR2 <- dplyr::select(allres, WB_adjRsq, MT_adjRsq)
boxR2 <- melt(grabR2)
## No id variables; using all as measure variables
ggplot(boxR2, aes(x=variable,y=value)) + geom_boxplot() + labs(x="Model",y="P value")

rsq01 <- dplyr::filter(allres, WB_adjRsq > 0.01 | MT_adjRsq > 0.01)
ggplot(rsq01, aes(x=WB_adjRsq, y=MT_adjRsq)) + geom_bin2d() + geom_abline(slope=1,intercept = 0) + labs(x=expression(paste("Whole Blood adjusted ", R^2)),y=expression(paste("Multi-Tissue adjusted ", R^2)))

grabRsq01 <- dplyr::select(rsq01, WB_adjRsq, MT_adjRsq)
boxRsq01 <- melt(grabRsq01)
## No id variables; using all as measure variables
ggplot(boxRsq01, aes(x=variable,y=value)) + geom_boxplot() + labs(x="Model",y="P value")

t.test(rsq01$WB_adjRsq,rsq01$MT_adjRsq)
##
## Welch Two Sample t-test
##
## data: rsq01$WB_adjRsq and rsq01$MT_adjRsq
## t = -18.692, df = 583.01, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.01273619 -0.01031422
## sample estimates:
## mean of x mean of y
## 0.004189188 0.015714393
t.test(rsq01$WB_adjRsq,rsq01$MT_adjRsq)$p.value
## [1] 1.924238e-61
summary(rsq01)
## obsgene predgene WB_adjRsq
## Length:293 Length:293 Min. :-0.0002068
## Class :character Class :character 1st Qu.: 0.0003125
## Mode :character Mode :character Median : 0.0017374
## Mean : 0.0041892
## 3rd Qu.: 0.0045095
## Max. : 0.0569376
## WB_Pval MT_adjRsq MT_Pval
## Min. :0.0000000 Min. :0.01001 Min. :0.000e+00
## 1st Qu.:0.0000017 1st Qu.:0.01131 1st Qu.:0.000e+00
## Median :0.0021599 Median :0.01321 Median :8.000e-13
## Mean :0.1266042 Mean :0.01571 Mean :5.979e-10
## 3rd Qu.:0.1130316 3rd Qu.:0.01674 3rd Qu.:3.512e-11
## Max. :0.9964125 Max. :0.05737 Max. :3.988e-08
## an_Fstat an_Pval logWB logMT
## Min. : 0.3231 Min. :0.00000 Min. : 0.001561 Min. : 7.399
## 1st Qu.: 7.4439 1st Qu.:0.00000 1st Qu.: 0.946800 1st Qu.:10.454
## Median : 9.5378 Median :0.00000 Median : 2.665564 Median :12.097
## Mean : 12.1548 Mean :0.01992 Mean : 4.911794 Mean :14.091
## 3rd Qu.: 13.4538 3rd Qu.:0.00000 3rd Qu.: 5.757709 3rd Qu.:15.723
## Max. :145.5990 Max. :0.90185 Max. :30.000000 Max. :30.000